import axios from '../../util/request'

//文章管理页面下拉框
export const writersel = () => {
    return axios.get(`/adminapi/cms/category?type=1`);
};

//文章管理列表
export const writerlist = (val) => {
    return axios.get(`/adminapi/cms/cms?pid=${val.pid}&title=${val.title}&page=${val.page}&limit=${val.limit}`);
};

//文章管理添加

export const writeradd = (val) => {
    return axios.post(`/adminapi/cms/cms`,val);
};

//文章管理删除
export const writerdel = (val) => {
    return axios.delete(`/adminapi/cms/cms/${val}`);
};

//文章关联下拉
export const writerguan = (val) => {
    return axios.get(`/adminapi/product/category/tree/1`);
};

//文章关联列表
export const writertable = (val) => {
    return axios.get(`/adminapi/product/product/list?page=${val.page}&limit=${val.limit}&cate_id=${val.ids}&store_name=${val.name}&is_live=0`);
};

//确定关联
export const writerlian = (val) => {
    return axios.put(`/adminapi/cms/cms/relation/${val.ids}`,{product_id:val.product_id});
};

//取消关联
export const writerun = (val) => {
    return axios.put(`/adminapi/cms/cms/unrelation/${val}`);
};